<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileOverview
<span class='line'>  3</span>  * mixing.enchant.js
<span class='line'>  4</span>  * &lt;p>A plugin for enchant.js which allows to mix 
<span class='line'>  5</span>  * arbitrary many {@link enchant.Class} classes together.
<span class='line'>  6</span>  * It is also possible to add functions and properties defined
<span class='line'>  7</span>  * as a recipe ({@link enchant.Class.MixingRecipe}) to arbitrary many classes to avoid copy and paste.&lt;/p>
<span class='line'>  8</span>  * &lt;p>Through this it is possible to achieve a behavior similar to multiple inheritance&lt;/p>
<span class='line'>  9</span>  * &lt;p>Requires:&lt;ul>
<span class='line'> 10</span>  * &lt;li>enchant.js v0.6 or later.&lt;/li>&lt;/ul>&lt;/p>
<span class='line'> 11</span>  * See also {@link enchant.Class.mixClasses}, {@link enchant.Class.MixingRecipe.createFromClass}, 
<span class='line'> 12</span>  * {@link enchant.Class.mixClassesFromRecipe}, {@link enchant.Class.MixingRecipe} and 
<span class='line'> 13</span>  * {@link enchant.Class.applyMixingRecipe} for an introduction.
<span class='line'> 14</span>  * @require enchant.js v0.6+
<span class='line'> 15</span>  *
<span class='line'> 16</span>  * @version 0.1
<span class='line'> 17</span>  * @author UEI Corporation (Kevin Kratzer)
<span class='line'> 18</span>  **/</span><span class="WHIT">
<span class='line'> 19</span> 
<span class='line'> 20</span> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">enchant</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="WHIT">    </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 22</span> 
<span class='line'> 23</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 24</span>          * @private
<span class='line'> 25</span>          */</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">decorateFunctionFactory</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">srcFunction</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">currentFunctionName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">firstResult</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">secondResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">                </span><span class="NAME">firstResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._mixing</span><span class="PUNC">[</span><span class="NAME">currentFunctionName</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">                </span><span class="NAME">secondResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">srcFunction.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 31</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">secondResult</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 32</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">secondResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">firstResult</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">firstResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 39</span> 
<span class='line'> 40</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 41</span>          * @private
<span class='line'> 42</span>          */</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">voidFunction</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 44</span> 
<span class='line'> 45</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 46</span>          * @private
<span class='line'> 47</span>          */</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">multipleMixingCombinationFunctionFactory</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">oldFunc</span><span class="PUNC">,</span><span class="NAME">newFunc</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">firstResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">oldFunc.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">mixingStore</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">                </span><span class="NAME">this._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">voidFunction</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">secondResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">newFunc.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">                </span><span class="NAME">this._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">mixingStore</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">secondResult</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">secondResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">firstResult</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">firstResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 62</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 63</span> 
<span class='line'> 64</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 65</span>          * @private
<span class='line'> 66</span>          */</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">createFromPrototypeNonRecursive</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">override</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">properties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">source.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">descriptor</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object.getOwnPropertyDescriptor</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">descriptor.value</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">descriptor.value</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">functionIgnoreNameList</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList.indexOf</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'constructor'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">functionOverrideNameList</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList.indexOf</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">                                </span><span class="NAME">decorate</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">decorateFunctionFactory</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">                                </span><span class="NAME">override</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">propertyIgnoreNameList</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList.indexOf</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'_mixing'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">                            </span><span class="NAME">properties</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">descriptor</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 87</span> 
<span class='line'> 88</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 89</span>          * @private
<span class='line'> 90</span>          */</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">createFromPrototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">,</span><span class="NAME">source</span><span class="PUNC">,</span><span class="NAME">onlyOwnProperties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">onlyOwnProperties</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">                </span><span class="NAME">createFromPrototype</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">,</span><span class="NAME">Object.getPrototypeOf</span><span class="PUNC">(</span><span class="NAME">source</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">onlyOwnProperties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 94</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">            </span><span class="NAME">createFromPrototypeNonRecursive</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">,</span><span class="NAME">source</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 97</span> 
<span class='line'> 98</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 99</span>          * @private
<span class='line'>100</span>          */</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">getFunctionParams</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">methodString</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">methodString</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">                </span><span class="NAME">methodString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">methodString.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">methodString.substring</span><span class="PUNC">(</span><span class="NAME">methodString.indexOf</span><span class="PUNC">(</span><span class="STRN">'('</span><span class="PUNC">)</span><span class="PUNC">+</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="NAME">methodString.indexOf</span><span class="PUNC">(</span><span class="STRN">')'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">replace</span><span class="PUNC">(</span><span class="REGX">/\s+/</span><span class="PUNC">,</span><span class="STRN">''</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">split</span><span class="PUNC">(</span><span class="STRN">','</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>107</span> 
<span class='line'>108</span> </span><span class="WHIT">        </span><span class="COMM">/*Public Interface */</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>110</span>          * @scope enchant.Class.MixingRecipe.prototype
<span class='line'>111</span>          */</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.MixingRecipe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">enchant.Class.create</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">            </span><span class="COMM">/**
<span class='line'>114</span>              * Creates a new MixingRecipe which is used for describing in which way functions and properties should be added during the mixing.
<span class='line'>115</span>              * To create a recipe from an existing class see {@link enchant.Class.MixingRecipe.createFromClass}
<span class='line'>116</span>              * @class This class is describing in which way the mixing will be performed on the target classes.
<span class='line'>117</span>              * For this purpose, MixingRecipe contains three properties:
<span class='line'>118</span>              * &lt;ul>&lt;li>decorateMethods (methods which will be decorated in the target, see decorator pattern)&lt;/li>
<span class='line'>119</span>              * &lt;li>overrideMethods (methods which will be overriden in the target)&lt;/li>
<span class='line'>120</span>              * &lt;li>overrideProperties (properties which will be redefined in the target)&lt;/li>&lt;/ul>
<span class='line'>121</span>              * &lt;p>See also {@link enchant.Class.mixClasses}, {@link enchant.Class.mixClassesFromRecipe} and {@link enchant.Class.applyMixingRecipe}.&lt;/p>
<span class='line'>122</span>              * @param {Object} decorateMethods The methods which will be decorated in the target, see decorator pattern. To access methods which have been decorated in the class resulting from mixing the _mixing property can be used, e.g. this._mixing.myFunction.apply(this,arguments).&lt;br>(Object containing key-value pairs, key := function name, value := function).
<span class='line'>123</span>              * @param {Object} overrideMethods The methods which will be overriden in the target.&lt;br>(Object containing key-value pairs, key := function name, value := function).
<span class='line'>124</span>              * @param {Object} properties The properties which will be redefined in the target.&lt;br>(Object containing key-value pairs, key := function name, value := property descriptor).
<span class='line'>125</span>              * @property {Object} decorateMethods The methods which will be decorated in the target, see decorator pattern. To access methods which have been decorated in the class resulting from mixing the _mixing property can be used, e.g. this._mixing.myFunction.apply(this,arguments).&lt;br>(Object containing key-value pairs, key := function name, value := function).
<span class='line'>126</span>              * @property {Object} overrideMethods The methods which will be overriden in the target.&lt;br>(Object containing key-value pairs, key := function name, value := function).
<span class='line'>127</span>              * @property {Object} overrideProperties The properties which will be redefined in the target.&lt;br>(Object containing key-value pairs, key := function name, value := property descriptor).
<span class='line'>128</span>              * @example
<span class='line'>129</span>              *      var recipe = new enchant.Class.MixingRecipe({
<span class='line'>130</span>              *          add : function(value) {
<span class='line'>131</span>              *              this._myValue += 3*value;
<span class='line'>132</span>              *              this._mixing.add.apply(this,arguments);
<span class='line'>133</span>              *          },
<span class='line'>134</span>              *          mult : function(value) {
<span class='line'>135</span>              *              this._myValue *= value*7;
<span class='line'>136</span>              *              this._mixing.mult.apply(this,arguments);
<span class='line'>137</span>              *          }
<span class='line'>138</span>              *      },{
<span class='line'>139</span>              *          sub : function(value) {
<span class='line'>140</span>              *              this._myValue -= 5*value;
<span class='line'>141</span>              *          }
<span class='line'>142</span>              *      },{
<span class='line'>143</span>              *      myProperty : {
<span class='line'>144</span>              *          get: function() {
<span class='line'>145</span>              *              return 3*this._myPropertyValue;
<span class='line'>146</span>              *          },
<span class='line'>147</span>              *          set : function(val) {
<span class='line'>148</span>              *              this._myPropertyValue = val;
<span class='line'>149</span>              *          }
<span class='line'>150</span>              *      }});
<span class='line'>151</span>              *      var NewClass = enchant.Class.applyMixingRecipe(Class1,recipe);
<span class='line'>152</span>              * @extends Object
<span class='line'>153</span>              * @constructs
<span class='line'>154</span>              */</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">            </span><span class="NAME">initialize</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">decorateMethods</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">overrideMethods</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">properties</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">                </span><span class="NAME">this.decorateMethods</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">decorateMethods</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">                </span><span class="NAME">this.overrideMethods</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">overrideMethods</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>158</span> </span><span class="WHIT">                </span><span class="NAME">this.overrideProperties</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">properties</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>161</span> 
<span class='line'>162</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>163</span>          * Takes the methods and properties of the given class to create a new MixingRecipe.
<span class='line'>164</span>          * The default behavior is to take all functions and properties of the given class
<span class='line'>165</span>          * including functions and properties defined in super classes, whereas functions
<span class='line'>166</span>          * are set to decorate the mixing target.&lt;br>Methods which are decorated will automatically
<span class='line'>167</span>          * call the soureClass method and the mixing target method (using the _mixing property) - 
<span class='line'>168</span>          * so there is no need to handle this yourself.
<span class='line'>169</span>          * &lt;p>To change the default behavior set the corresponding arguments of the function.&lt;/p>
<span class='line'>170</span>          * 
<span class='line'>171</span>          * @param {Function&lt;constructor function created with enchant.Class>} sourceClass The class which will be used to create the recipe.
<span class='line'>172</span>          * @param [boolean] onlyOwnProperties If set to true, the functions and properties of the super classes will be ignored.
<span class='line'>173</span>          * @param [Array&lt;String>] functionOverrideNameList An array containing names of functions which should be set to override functions in the target during mixing.
<span class='line'>174</span>          * @param [Array&lt;String>] functionIgnoreNameList An array containing names of functions which should be ignored when creating the recipe.
<span class='line'>175</span>          * @param [Array&lt;String>] propertyIgnoreNameList An array containing names of properties which should be ignored when creating the recipe.
<span class='line'>176</span>          * @returns {enchant.Class.MixingRecipe} The MixingRecipe created from the definition of the sourceClass.
<span class='line'>177</span>          * @example
<span class='line'>178</span>          *      var recipe = enchant.Class.MixingRecipe.createFromClass(Class2, true, 
<span class='line'>179</span>          *              ['overrideFunction1','overrideFunction2'],
<span class='line'>180</span>          *              ['ignoreFunction1','ignoreFunction2'],
<span class='line'>181</span>          *              ['ignoreProperty1','ignorePropterty2']);
<span class='line'>182</span>          *      recipe.overrideMethods['additionalFunction'] = new function() {
<span class='line'>183</span>          *          console.log('Hello, World');
<span class='line'>184</span>          *      }
<span class='line'>185</span>          *      recipe.overrideProperties['newProperty'] = {
<span class='line'>186</span>          *          get: function() {
<span class='line'>187</span>          *              return this._newProperty;
<span class='line'>188</span>          *          },
<span class='line'>189</span>          *          set : function(val) {
<span class='line'>190</span>          *              this._newProperty = val;
<span class='line'>191</span>          *          }
<span class='line'>192</span>          *      }
<span class='line'>193</span>          *      var NewClass = enchant.Class.mixClassesFromRecipe(Class1,Class2,recipe);
<span class='line'>194</span>          * @constructs
<span class='line'>195</span>          * @static
<span class='line'>196</span>          */</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.MixingRecipe.createFromClass</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">sourceClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">onlyOwnProperties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>198</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">decorate</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>199</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">override</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">properties</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>201</span> 
<span class='line'>202</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">source</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">sourceClass.prototype</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>203</span> </span><span class="WHIT">            </span><span class="NAME">createFromPrototype</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">,</span><span class="NAME">source</span><span class="PUNC">,</span><span class="NAME">onlyOwnProperties</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionOverrideNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">functionIgnoreNameList</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">propertyIgnoreNameList</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">enchant.Class.MixingRecipe</span><span class="PUNC">(</span><span class="NAME">decorate</span><span class="PUNC">,</span><span class="NAME">override</span><span class="PUNC">,</span><span class="NAME">properties</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>205</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>206</span> 
<span class='line'>207</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>208</span>          * Uses the given MixingRecipe, applies it to the first class and returns the result - the MixingRecipe should correspond to the secondClass.
<span class='line'>209</span>          * A default initialize method will be added which will call the initialize functions of both classes.
<span class='line'>210</span>          * The signature for the default initialize method is:&lt;br>
<span class='line'>211</span>          * ([firstClass constructor arg 1],...,[firstClass constructor arg n],[secondClass constructor arg1],...[secondClass constructor arg n])
<span class='line'>212</span>          * &lt;p>Both classes will not be modified.&lt;/p> See also: {@link enchant.Class.MixingRecipe}
<span class='line'>213</span>          * 
<span class='line'>214</span>          * @param {Function&lt;constructor function created with enchant.Class>} firstClass The class to which the recipe will be applied.
<span class='line'>215</span>          * @param {Function&lt;constructor function created with enchant.Class>} secondClass The class which is related to the MixingRecipe, used for the default initialize function.
<span class='line'>216</span>          * @param {enchant.Class.MixingRecipe} recipe The recipe which is applied to the first class - should correspond to the secondClass. 
<span class='line'>217</span>          * @param [Function] initializeMethod If provided, this function will be used to initialize the resulting class instead of the default initialize method.
<span class='line'>218</span>          * @returns {Function&lt;constructor function created with enchant.Class>} initializeMethod The class which is the result of mixing both classes using the recipe.
<span class='line'>219</span>          * @example
<span class='line'>220</span>          *      var MapGroup = enchant.Class.mixClasses(Map, Group,true);
<span class='line'>221</span>          *      var map = new MapGroup(16, 16);
<span class='line'>222</span>          *      var SpriteLabel = enchant.Class.mixClasses(Sprite, Label,true);
<span class='line'>223</span>          *      var kumaLabel = new SpriteLabel(32,32,'Kuma');
<span class='line'>224</span>          * @static
<span class='line'>225</span>          */</span><span class="WHIT">
<span class='line'>226</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.mixClassesFromRecipe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">firstClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">secondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">recipe</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">initializeMethod</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>227</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">enchant.Class.applyMixingRecipe</span><span class="PUNC">(</span><span class="NAME">firstClass</span><span class="PUNC">,</span><span class="NAME">recipe</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">paramLength</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">getFunctionParams</span><span class="PUNC">(</span><span class="NAME">firstClass.prototype.initialize</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>229</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">initializeMethod</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT">                </span><span class="NAME">initializeMethod</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Array.prototype.slice.call</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT">                    </span><span class="NAME">secondClass.prototype.initialize.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">args.slice</span><span class="PUNC">(</span><span class="NAME">paramLength</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>233</span> </span><span class="WHIT">                    </span><span class="NAME">firstClass.prototype.initialize.apply</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="NAME">args.slice</span><span class="PUNC">(</span><span class="NUMB">0</span><span class="PUNC">,</span><span class="NAME">paramLength</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>234</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>235</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>236</span> </span><span class="WHIT">            </span><span class="NAME">result.prototype.initialize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">initializeMethod</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>237</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>238</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>239</span> 
<span class='line'>240</span> 
<span class='line'>241</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>242</span>          * Creates an MixingRecipe out of the second class, applies it to the first class and returns the result.
<span class='line'>243</span>          * The default behavior is to take all functions and properties of the second class,
<span class='line'>244</span>          * including functions and properties defined in its super classes, whereas functions
<span class='line'>245</span>          * are set to decorate the mixing target.&lt;br>Methods which are decorated will automatically
<span class='line'>246</span>          * call the soureClass method and the mixing target method (using the _mixing property) - 
<span class='line'>247</span>          * so there is no need to handle this yourself.
<span class='line'>248</span>          * &lt;p>Furthermore, a default initialize method will be added which will
<span class='line'>249</span>          * call the initialize functions of both classes. The signature for the default initialize method is:&lt;br>
<span class='line'>250</span>          * ([firstClass constructor arg 1],...,[firstClass constructor arg n],[secondClass constructor arg 1],...[secondClass constructor arg n])&lt;/p>
<span class='line'>251</span>          * &lt;p>Both classes will not be modified.&lt;/p> See also: {@link enchant.Class.MixingRecipe}
<span class='line'>252</span>          * 
<span class='line'>253</span>          * @param {Function&lt;constructor function created with enchant.Class>} firstClass The class to which the recipe will be applied.
<span class='line'>254</span>          * @param {Function&lt;constructor function created with enchant.Class>} secondClass The class from which the recipe will be created
<span class='line'>255</span>          * @param [boolean] useOnlyOwnPropertiesForSecondClass If set to true, the functions and properties of the super classes will be ignored during the recipe creation of the secondClass.
<span class='line'>256</span>          * @param [Function] initializeMethod If provided, this function will be used to initialize the resulting class instead of the default initialize method.
<span class='line'>257</span>          * @returns {Function&lt;constructor function created with enchant.Class>} The class which is the result of mixing both classes.
<span class='line'>258</span>          * @example
<span class='line'>259</span>          *      var MapGroup = enchant.Class.mixClasses(Map, Group,true);
<span class='line'>260</span>          *      var map = new MapGroup(16, 16);
<span class='line'>261</span>          *      var SpriteLabel = enchant.Class.mixClasses(Sprite, Label,true);
<span class='line'>262</span>          *      var kumaLabel = new SpriteLabel(32,32,'Kuma');
<span class='line'>263</span>          * @static
<span class='line'>264</span>          */</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.mixClasses</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">firstClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">secondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">useOnlyOwnPropertiesForSecondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">initializeMethod</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">enchant.Class.mixClassesFromRecipe</span><span class="PUNC">(</span><span class="NAME">firstClass</span><span class="PUNC">,</span><span class="NAME">secondClass</span><span class="PUNC">,</span><span class="NAME">enchant.Class.MixingRecipe.createFromClass</span><span class="PUNC">(</span><span class="NAME">secondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">useOnlyOwnPropertiesForSecondClass</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">'initialize'</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">initializeMethod</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>268</span> 
<span class='line'>269</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>270</span>          * Applies the defined MixingRecipe to the target class creating a new class definition which is then returned.
<span class='line'>271</span>          * The target class is not modified directly.&lt;br>See also: {@link enchant.Class.MixingRecipe}.
<span class='line'>272</span>          * 
<span class='line'>273</span>          * @param {Function&lt;constructor function created with enchant.Class>} target The class to which the recipe will be applied.
<span class='line'>274</span>          * @param {enchant.Class.MixingRecipe} source The MixingRecipe which is used to add new functionality to the target.
<span class='line'>275</span>          * @returns {Function&lt;constructor function created with enchant.Class>} The class which is the result of mixing the target class with the source recipe.
<span class='line'>276</span>          * @example
<span class='line'>277</span>          *      var recipe = new enchant.Class.MixingRecipe({
<span class='line'>278</span>          *         // ... see enchant.Class.MixingRecipe
<span class='line'>279</span>          *      },{
<span class='line'>280</span>          *          // ... see enchant.Class.MixingRecipe
<span class='line'>281</span>          *      },{
<span class='line'>282</span>          *          // ... see enchant.Class.MixingRecipe
<span class='line'>283</span>          *      });
<span class='line'>284</span>          *      var NewClass = applyMixingRecipe(Class1,recipe);
<span class='line'>285</span>          * @static
<span class='line'>286</span>          */</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT">        </span><span class="NAME">enchant.Class.applyMixingRecipe</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>288</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">result</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">enchant.Class.create</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>289</span> </span><span class="WHIT">            </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">result.prototype</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>290</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">recipeKey</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>291</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">source.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">recipeKey</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>292</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">source</span><span class="PUNC">[</span><span class="NAME">recipeKey</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>293</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">recipeKey</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'overrideMethods'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>294</span> </span><span class="WHIT">                        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">methodKey</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>295</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">currentSource.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">methodKey</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>296</span> </span><span class="WHIT">                                </span><span class="NAME">target</span><span class="PUNC">[</span><span class="NAME">methodKey</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">[</span><span class="NAME">methodKey</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT">                                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target._mixing</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">methodKey</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT">                                    </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">methodKey</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">voidFunction</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>299</span> </span><span class="WHIT">                                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>300</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>301</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>302</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">recipeKey</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'overrideProperties'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>303</span> </span><span class="WHIT">                        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">propertyKey</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>304</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">currentSource.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">propertyKey</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>305</span> </span><span class="WHIT">                                </span><span class="NAME">Object.defineProperty</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="NAME">propertyKey</span><span class="PUNC">,</span><span class="NAME">currentSource</span><span class="PUNC">[</span><span class="NAME">propertyKey</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>306</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>308</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">recipeKey</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'decorateMethods'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>309</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">target._mixing</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>310</span> </span><span class="WHIT">                            </span><span class="NAME">target._mixing</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>311</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>312</span> </span><span class="WHIT">                        </span><span class="KEYW">for</span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>313</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">currentSource.hasOwnProperty</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>314</span> </span><span class="WHIT">                                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">targetHolder</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT">                                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">target</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT">                                    </span><span class="KEYW">while</span><span class="PUNC">(</span><span class="NAME">targetHolder</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">targetHolder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT">                                        </span><span class="NAME">targetHolder</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object.getPrototypeOf</span><span class="PUNC">(</span><span class="NAME">targetHolder</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT">                                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT">                                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>320</span> </span><span class="WHIT">                                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>321</span> </span><span class="WHIT">                                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">newFunc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">targetHolder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>322</span> </span><span class="WHIT">                                    </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">multipleMixingCombinationFunctionFactory</span><span class="PUNC">(</span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="NAME">newFunc</span><span class="PUNC">,</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>323</span> </span><span class="WHIT">                                </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>324</span> </span><span class="WHIT">                                    </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">targetHolder</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>325</span> </span><span class="WHIT">                                    </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT">                                        </span><span class="NAME">target._mixing</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">voidFunction</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>327</span> </span><span class="WHIT">                                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>328</span> </span><span class="WHIT">                                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT">                                </span><span class="NAME">target</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currentSource</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>338</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>339</span> </span></pre></body></html>